var events=require('events');
var Emitter=events.EventEmitter;
function Dog(name,energy){
    Emitter.call(this);
    this.name=name;
    this.energy=energy;
}
Dog.prototype=Emitter.prototype;
Dog.prototype.bark=function(){
    this.energy--;
    console.log(`${this.name} barked! energy:${this.energy}`);
}
module.exports=Dog;